<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#d1{
				position: absolute;
                top: 0px;
                left: 0px;
                
			}
		</style>
		<script>
			var i=0;
			var timer;
			function T(){
				var obj=document.getElementById("s1");
				obj.innerHTML=i++;
				timer=setTimeout("T()",500);
			}
			function stop(){
			clearTimeout(timer);	
			}
			
			var x,y;
			var obj
			function F(){
				 obj=document.getElementById("d1");
				  x=Math.floor(Math.random()*600+10);
				  y=Math.floor(Math.random()*400+10);
				  
				  obj.style.top=y+"px";
				  obj.style.left=x+"px";
			}
			window.onload=F;
		</script>
	</head>
	<body>
		<span id="s1"></span>
		<button onclick="T()">开始计数</button>
		&nbsp;&nbsp;&nbsp;
		<button onclick="stop()">停止</button>
		
		<div id="d1">
			<img src="../img/t2.gif" />
		</div>
	</body>
</html>
